#include<bits/stdc++.h>
#define int long long
using namespace std;
const int Maxn = 100010;
int n, m, ans;
void dfs(int x, vector<int> a){
	if(x > m){
		for(int i = 1 ; i < n ; i++){
			if(a[i] < a[i - 1]) return ;
		}
		ans++;
		return ;
	}
	dfs(x + 1, a);
	vector<int> b;
	for(int i = 1 ; i < n ; i++){
		b.clear();
		for(int j = 1 ; j <= i ; j++)
			b.push_back(a[j]);
		b.push_back(a[0]);
		for(int j = i + 1 ; j < n ; j++)
			b.push_back(a[j]);
		dfs(x + 1, b);
	}
}
signed main(){
	ios::sync_with_stdio(false);
	freopen("drama.in", "r", stdin);
	freopen("drama.out", "w", stdout);
	cin >> n >> m;
	vector<int> a;
	for(int i = 1 ; i <= n ; i++) a.push_back(i);
	dfs(1, a);
	cout << ans << '\n';
	return 0;
}
/*
drama
*/